<?php
    class View {
    
    	private $pageVars = array();
    	private $template;
        public $smarty;
    
    	public function __construct($template)
    	{
            $this->smarty = new Smarty;
            $this->smarty->template_dir = BASE_TPL_PATH.TEMPLATES;
            $this->smarty->compile_dir = BASE_TPL_PATH.TEMPLATES_C;
            $this->smarty->cache_dir = BASE_TPL_PATH.CACHE;
            $this->smarty->config_dir = BASE_TPL_PATH.CONFIGS;
            $this->template = $template.'.tpl';
            $this->smarty->assign('js',SYSTEM_LIB_PATH_JS);
    	}
    
    	public function set($var, $val)
    	{
    		$this->pageVars[$var] = $val;
    	}
    
    	public function render()
    	{
    		extract($this->pageVars);
            $this->smarty->display($this->template);
    	}
        
    }